<!---
	Title:		EPAR1.1 
	Author:		Bruce Frick
	Purpose:	Employee Search - Index post's a search string to this page.  Appsearch.cfm post's a search string to this page
--->

<cfparam name="FORM.SearchString" default="">

<cfset BASE = CreateObject("component", "cfc.base") />
<cfset searchQueries = CreateObject("component", "cfc.searchQueries") />

<cfoutput>
<!---HTML header, css links, js links, and page title--->
#BASE.htmlHeader(
    "", <!---JS links--->
    "", <!---CSS links--->
    "Employee Search", <!---Page Title--->
    "Status" <!---Active Nav Link--->
)#
<!---HTML header, css links, js links, and page title--->
    
    <cfif Session.strAuthType NEQ ''>
		
        <h1 class="title">Employee Search List</h1>
		<div class="entry">
            <table width="80%">
                <tr>
                    <td><strong>Full Name</strong></td>
                    <td><strong>SSN</strong></td>
                </tr>
                <cfset qryEmployeeSearch = searchQueries.funcEmployeeSearch(FORM.SearchString) />
                <cfloop query='qryEmployeeSearch'>
                <cfif #qryEmployeeSearch.preferredname# neq "">
                    <cfset EmployeeNameDisplay = #qryEmployeeSearch.First# & ' ' & 
                        '(#qryEmployeeSearch.preferredname#)' & ' ' & 
                        #qryEmployeeSearch.last#> <!---Scott Code--->
                <cfelse>
                    <cfset EmployeeNameDisplay = #First# & ' ' & 
                        #last#> <!---Scott Code--->
                </cfif>        
                    <tr>
                        <td>
                            <a href="SearchResults.cfm?EmployeeID=#qryEmployeeSearch.id#">#EmployeeNameDisplay#</a>
                        </td>
                        <td>
                            #ssn#
                        </td>
                    </tr>
                </cfloop>
            </table>
        </div>
    	
    <cfelse>
        <cfinclude template="Denied.cfm">
    </cfif>

<!---HTML footer, closes html and body tags.  Any footer info goes here--->
#BASE.htmlFooter()#
<!---HTML footer, closes html and body tags.  Any footer info goes here--->
</cfoutput>